package com.hsc.yalebao.secret;

import android.content.Context;
import android.content.res.Resources;
import android.os.Environment;
import android.util.Base64;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;

public class SecretUtil
{
  public static String decrypt(String paramString)
  {
    String str = new String(Base64.decode(paramString, 0));
    if (str == null)
      return null;
    byte[] arrayOfByte = str.getBytes();
    for (int i = -1 + arrayOfByte.length; ; i--)
    {
      if (i <= 0)
      {
        arrayOfByte[0] = ((byte)(0x12 ^ arrayOfByte[0]));
        return new String(arrayOfByte);
      }
      arrayOfByte[i] = ((byte)(arrayOfByte[i] ^ arrayOfByte[(i - 1)]));
    }
  }

  public static String decrypt2(String paramString)
  {
    byte[] arrayOfByte = new String(Base64.decode(paramString, 0)).getBytes();
    if (arrayOfByte == null)
      return null;
    int i = arrayOfByte.length;
    for (int j = 0; ; j++)
    {
      if (j >= i)
        return new String(arrayOfByte);
      arrayOfByte[j] = ((byte)(0x12 ^ arrayOfByte[j]));
    }
  }

  public static String encrypt(String paramString)
  {
    byte[] arrayOfByte = paramString.getBytes();
    if (arrayOfByte == null)
      return null;
    int i = arrayOfByte.length;
    int j = 18;
    for (int k = 0; ; k++)
    {
      if (k >= i)
        return new String(Base64.encode(new String(arrayOfByte).getBytes(), 0));
      arrayOfByte[k] = ((byte)(j ^ arrayOfByte[k]));
      j = arrayOfByte[k];
    }
  }

  public static String encrypt2(String paramString)
  {
    byte[] arrayOfByte = paramString.getBytes();
    if (arrayOfByte == null)
      return null;
    int i = arrayOfByte.length;
    for (int j = 0; ; j++)
    {
      if (j >= i)
        return new String(Base64.encode(new String(arrayOfByte).getBytes(), 0));
      arrayOfByte[j] = ((byte)(0x12 ^ arrayOfByte[j]));
    }
  }

  public static String gagaJiami(String paramString)
  {
    try
    {
      String str2 = URLEncoder.encode(paramString, "UTF-8");
      paramString = str2;
      arrayOfChar = paramString.toCharArray();
      int i = arrayOfChar.length;
      str1 = "";
      j = 0;
      if (j >= i)
        return new String(Base64.encode(str1.getBytes(), 0));
    }
    catch (UnsupportedEncodingException localUnsupportedEncodingException)
    {
      while (true)
      {
        char[] arrayOfChar;
        int j;
        localUnsupportedEncodingException.printStackTrace();
        continue;
        String str1 = str1 + (char)(arrayOfChar[j] ^ 18 + j % 9);
        j++;
      }
    }
  }

  public static String gagaJiemi(String paramString)
  {
    char[] arrayOfChar = new String(Base64.decode(paramString.getBytes(), 0)).toCharArray();
    int i = arrayOfChar.length;
    String str1 = "";
    int j = 0;
    while (true)
    {
      if (j >= i);
      try
      {
        String str2 = URLDecoder.decode(str1, "UTF-8");
        return str2;
        str1 = str1 + (char)(arrayOfChar[j] ^ 18 + j % 9);
        j++;
      }
      catch (UnsupportedEncodingException localUnsupportedEncodingException)
      {
        localUnsupportedEncodingException.printStackTrace();
      }
    }
    return str1;
  }

  public static String getEnString(Context paramContext, int paramInt)
  {
    InputStream localInputStream = paramContext.getResources().openRawResource(paramInt);
    try
    {
      InputStreamReader localInputStreamReader1 = new InputStreamReader(localInputStream, "utf-8");
      localInputStreamReader2 = localInputStreamReader1;
      localBufferedReader = new BufferedReader(localInputStreamReader2);
      localStringBuffer = new StringBuffer("");
    }
    catch (UnsupportedEncodingException localUnsupportedEncodingException)
    {
      try
      {
        while (true)
        {
          InputStreamReader localInputStreamReader2;
          BufferedReader localBufferedReader;
          StringBuffer localStringBuffer;
          String str = localBufferedReader.readLine();
          if (str == null)
          {
            return localStringBuffer.toString();
            localUnsupportedEncodingException = localUnsupportedEncodingException;
            localUnsupportedEncodingException.printStackTrace();
            localInputStreamReader2 = null;
          }
          else
          {
            localStringBuffer.append(str);
          }
        }
      }
      catch (IOException localIOException)
      {
        while (true)
          localIOException.printStackTrace();
      }
    }
  }

  public static String jiami1(String paramString, int paramInt)
  {
    StringBuffer localStringBuffer = new StringBuffer();
    for (int i = 0; ; i++)
    {
      if (i >= paramString.length())
        return new String(Base64.encode(new StringBuilder().append(localStringBuffer).toString().getBytes(), 0));
      localStringBuffer.append((char)(paramInt ^ paramString.charAt(i)));
    }
  }

  public static String jiemi1(String paramString, int paramInt)
  {
    String str = new String(Base64.decode(paramString, 0));
    StringBuffer localStringBuffer = new StringBuffer();
    for (int i = 0; ; i++)
    {
      if (i >= str.length())
        return localStringBuffer;
      localStringBuffer.append((char)(paramInt ^ str.charAt(i)));
    }
  }

  public void saveFile(String paramString1, String paramString2)
  {
    String str = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "ip" + File.separator + paramString2 + ".txt";
    try
    {
      File localFile = new File(str);
      if (!localFile.exists())
      {
        new File(localFile.getParent()).mkdirs();
        localFile.createNewFile();
      }
      FileOutputStream localFileOutputStream = new FileOutputStream(localFile);
      localFileOutputStream.write(paramString1.getBytes());
      localFileOutputStream.close();
      return;
    }
    catch (FileNotFoundException localFileNotFoundException)
    {
      localFileNotFoundException.printStackTrace();
      return;
    }
    catch (IOException localIOException)
    {
      localIOException.printStackTrace();
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.hsc.yalebao.secret.SecretUtil
 * JD-Core Version:    0.6.2
 */